//
//  KVNFakeViewController.m
//  Test1
//
//  Created by KelvinYeung on 15/8/16.
//  Copyright (c) 2015年 KelvinYeung. All rights reserved.
//

#import "KVNFakeViewController.h"

@interface KVNFakeViewController ()

@end

@implementation KVNFakeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
     self.tabBarController.tabBar.hidden =YES;
    CGRect appFrame = [[UIScreen mainScreen] bounds];
    
    UIScrollView *mainView = [[UIScrollView alloc] initWithFrame:appFrame];
    mainView.alwaysBounceHorizontal = NO;
    mainView.showsVerticalScrollIndicator = NO;
    mainView.backgroundColor = [UIColor colorWithWhite:0.95 alpha:1];
    self.view = mainView;
    
    UIImageView * imageView = [[UIImageView alloc] init];
    
    
    switch (_controllerType) {
        case KVN_FAKE_VIEW_CALCULATOR:
            [imageView setImage:[UIImage imageNamed:@"housePriceCalculator1"]];
            break;
            
        case KVN_FAKE_VIEW_MAP:
            [imageView setImage:[UIImage imageNamed:@"findInMap"]];
            break;
        case KVN_FAKE_VIEW_CHECK_PRICE:
            [imageView setImage:[UIImage imageNamed:@"checkHousePirce"]];
            break;
        case KVN_FAKE_VIEW_MY_DETAIL:
            [imageView setImage:[UIImage imageNamed:@"myDetailView"]];
            break;
        case KVN_FAKE_VIEW_MY_MSG:
            [imageView setImage:[UIImage imageNamed:@"cell_loading"]];
            break;
        case KVN_FAKE_VIEW_MY_CALL:
            [imageView setImage:[UIImage imageNamed:@"cell_loading"]];
            break;
        case KVN_FAKE_VIEW_MY_DATE:
            [imageView setImage:[UIImage imageNamed:@"cell_loading"]];
            break;
        case KVN_FAKE_VIEW_MY_COMMENT:
            [imageView setImage:[UIImage imageNamed:@"cell_loading"]];
            break;
        case KVN_FAKE_VIEW_MY_WALLET:
            [imageView setImage:[UIImage imageNamed:@"myWalletView"]];
            break;
        case KVN_FAKE_VIEW_MY_FAVOR:
            [imageView setImage:[UIImage imageNamed:@"myFavorView"]];
            break;
        case KVN_FAKE_VIEW_MY_APP:
            [imageView setImage:[UIImage imageNamed:@"myAppView"]];
            break;
        case KVN_FAKE_VIEW_MY_ORDER:
            [imageView setImage:[UIImage imageNamed:@"myOrderView"]];
            break;
        case KVN_FAKE_VIEW_MY_TOOL:
            [imageView setImage:[UIImage imageNamed:@"myToolsView"]];
            break;
        case KVN_FAKE_VIEW_MY_SETTING:
            [imageView setImage:[UIImage imageNamed:@"mySettingView"]];
            break;
 
        default:
            break;
    }
    
    CGSize imageSize = [self scaleImageSize:imageView.image];
    imageView.frame = CGRectMake(0, 0, imageSize.width, imageSize.height);
    
    imageView.contentMode = UIViewContentModeScaleAspectFit;
    [self.view addSubview:imageView];
    mainView.contentSize = CGSizeMake(imageSize.width, imageSize.height - 50);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (CGSize) scaleImageSize:(UIImage*)image{

    
    float scale = image.size.width /self.view.frame.size.width;
   
    float height = image.size.height/ scale;
    
    return CGSizeMake(self.view.frame.size.width, height);
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
